In [72]:
import numpy as np

def sigmoid(t):
    return np.exp(t)/(1+np.exp(t))



x_true = np.array([19, 23, 15])
N = len(x_true)
beta = 0.05

R = np.zeros((N,N))

for i in range(N):
    for j in range(N):
        if i > j:
            delta = x_true[i] - x_true[j]
            p = sigmoid(beta*delta)
            r = np.random.choice([0,1],p=[1-p, p])
            R[i,j] = r
            R[j, i] = 1-r
                        
print(R)


[[ 0.  0.  1.]
 [ 1.  0.  1.]
 [ 0.  0.  0.]]

Plot the histograms x_samp for each player apart from player 0


In [93]:
EPOCH = 1000
x = np.array([19, 89, 27])


for epoch in range(EPOCH):
    for j in range(1,N):
        x1 = np.arange(0, 100)
        LL = np.zeros((len(x1)))

        for i in range(N):
            if i != j:
                delta = x1 - x[i]
                lp = np.log(sigmoid(delta*beta))
                lp0 = np.log(1-sigmoid(delta*beta))
                LL += R[j,i]*lp + R[i,j]*lp0

        pp = np.exp(LL - np.max(LL))
        pp = pp/np.sum(pp)
        x_samp = np.random.choice(range(0,100),p=pp)
        x[j] = x_samp

        if j==2:
            print(x_samp)


38
20
1
27
45
4
19
27
12
62
11
28
17
22
31
29
15
21
17
1
29
10
36
37
37
58
44
9
1
69
60
13
16
25
15
9
11
11
24
28
21
6
56
22
28
43
6
8
1
75
36
37
32
15
2
7
34
94
16
56
32
29
14
39
21
54
19
97
86
8
8
65
33
21
12
11
6
8
38
5
1
8
10
1
20
22
7
4
75
80
0
41
34
48
43
19
11
27
43
44
5
4
19
37
24
16
45
14
9
28
10
27
67
0
25
4
19
5
16
9
39
32
43
43
73
35
36
41
55
43
9
37
45
30
20
3
4
39
4
83
61
52
12
3
78
14
1
37
53
20
67
9
43
6
13
32
8
10
45
7
22
26
0
7
20
45
45
67
20
8
40
23
23
11
44
7
12
6
16
44
5
35
24
51
53
11
44
16
18
21
38
6
20
32
6
9
3
20
46
53
43
66
51
51
19
36
8
35
11
8
31
49
25
48
1
16
31
19
38
3
47
28
12
4
14
33
8
22
19
6
18
69
46
48
3
31
10
4
5
82
42
18
14
64
68
39
41
39
28
27
7
4
20
10
23
35
5
40
39
53
85
17
6
29
16
25
47
5
2
39
36
13
51
69
9
17
36
16
1
85
29
17
26
31
19
27
10
16
67
21
19
76
15
11
53
27
63
2
45
13
5
14
31
17
11
3
54
25
49
32
10
27
10
18
36
20
9
36
30
24
52
5
1
31
3
37
39
23
30
50
72
2
4
56
1
41
41
19
55
43
28
18
34
33
88
18
14
69
26
43
35
8
32
12
15
61
28
28
2
21
2
5
42
16
63
0
9
67
14
63
46
2
50
36
36
1
20
6
53
31
42
24
18
11
31
5
35
49
41
59
33
32
9
58
2
3
69
19
82
83
68
25
7
4
0
26
9
12
57
26
46
49
53
27
12
15
63
24
43
47
32
51
82
58
16
30
36
29
23
0
19
42
18
0
6
57
16
3
33
21
38
9
30
20
14
29
17
43
20
0
9
26
29
9
84
26
60
57
2
22
9
26
22
52
51
35
1
23
8
7
31
1
70
2
26
48
39
53
48
16
52
3
1
54
28
61
45
5
1
21
17
70
38
43
6
26
11
61
1
4
0
11
39
25
10
9
19
6
50
79
32
26
61
11
14
24
24
50
2
39
42
57
34
29
31
26
26
70
29
13
2
5
24
37
28
45
23
43
8
39
12
20
39
12
4
2
32
25
14
16
1
11
33
58
10
68
13
65
17
7
14
6
13
12
0
11
8
65
3
19
10
50
36
33
16
23
79
20
24
2
32
3
1
4
44
31
78
22
27
7
26
59
60
8
58
8
43
18
50
1
16
2
5
9
56
0
4
29
12
73
28
25
11
96
13
50
19
1
84
66
29
21
59
13
58
5
13
62
2
20
40
63
22
8
8
28
24
87
19
14
74
5
45
8
40
64
10
29
23
21
27
40
25
50
35
65
39
6
34
81
29
56
68
1
4
38
11
9
53
6
12
11
71
11
1
10
20
33
15
21
0
1
19
53
7
22
2
28
27
14
78
26
31
15
54
11
1
9
18
36
79
53
42
83
26
46
53
6
68
43
0
24
15
34
40
17
20
15
10
10
16
82
13
7
33
53
37
51
58
36
31
63
60
44
3
29
45
17
6
5
69
52
33
17
5
13
30
11
58
27
52
3
61
74
49
45
36
18
13
45
41
49
28
14
2
4
19
2
1
64
54
26
11
89
41
19
43
27
14
68
55
13
20
50
15
66
16
23
31
29
44
23
68
27
33
19
65
5
15
54
16
14
21
12
11
41
7
42
15
12
66
13
34
68
23
59
6
6
68
22
69
3
13
10
29
17
13
5
0
50
11
60
23
10
65
12
45
14
0
2
15
17
10
2
24
22
52
51
14
47
5
25
25
47
10
27
25
49
1
19
7
16
34
78
6
9
51
8
26
9
3
7
43
14
19
15
20
25
56
30
70
12
17
64
2
15
36
61
4
7
53
33
47
14
20
2
16
59
15
16
31
48
34
34
62
29
13
33
41
60
28
16
41
46
8
5
72
0
4
39
18
58
64
16
48
49
30
78
9
0
7
0
46
28
24
8
49
27
25
17
13
33
5
14
49
68
46
41
3
41
83
24
3
4
22
0
10
4
27
9
29
52
23
33
37
14
13
3
27
50
27
13
7
28
49
14
12
4
2
58
29
45
38
66
41
0
8
33
16
26
10
55
7
23
21
17
30
62
25
16

In [91]:
%matplotlib inline
import matplotlib.pylab as plt

plt.plot(np.exp(LL))
plt.show()